/************************************************
 * Author       :   XXY
 * Blog         :   https://www.cnblogs.com/jzyl
 * Email        :   1047185209@QQ.com
 * FileName     :   CompileEvent.cs
 * CreateData   :   2023/4/28 10:13:44
 * UnityVersion :   2020.3.33f1c2
 * Description  :   编译事件
************************************************/
#pragma warning disable CS0436 // 类型与导入类型冲突
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;

public class CompileEvent : Editor
{
    [InitializeOnLoadMethod]
    static void Init()
    {
        CompilationPipeline.compilationFinished += OnCompilationFinished;
        CompilationPipeline.compilationStarted += OnCompilationStarted;
        EditorApplication.quitting += OnQuitting;
        SceneView.beforeSceneGui += OnBeforeSceneGui;
    }

    private static void OnCompilationStarted(object obj)
    {
        //Debug.Log("编译Code开始！");
    }

    static void OnQuitting()
    {
        //Debug.Log("编辑器退出");
        CompilationPipeline.compilationStarted -= OnCompilationStarted;
        CompilationPipeline.compilationFinished -= OnCompilationFinished;
    }
    private static void OnCompilationFinished(object obj)
    {
        //Debug.Log("编译Code完成！");
        HotfixUtilities.CopyHotdixDll();
    }
    private static void OnBeforeSceneGui(SceneView view)
    {
        //Debug.Log("调用 OnGUI 方法");
    }
}
